#!/bin/sh
# Helper script to cross-compile Windows/MinGW distribution.
# Since Windows doesn't understand shebang magic, we make the gauche
# scripts (e.g. gauche-install) to exe files.
#

set -e

target=$1

cat <<EOF
#include "gauche.h"

static const char* script = "\\n"
EOF

sed -e 's@\\@\\\\@g' -e 's@"@\\"@g' -e 's@^.*$@"&\\n"@g' $1

cat <<EOF
;

int main(int argc, const char **argv)
{
    Scm_Init(GAUCHE_SIGNATURE);
    Scm_SimpleMain(argc, argv, script, 0);
    return 0;
}
EOF
